{extend name="public/common"} {block name="body"}
<style>
	#zzc{width:100%;height:100%;background:#000;opacity: .3;position:fixed;top:0;z-index: 4;display:none;}
	#tsk{width:200px;height:75px;background:#ccc;position:fixed;top:300px;left:50%;display:none;margin-left:-100px;z-index:6;line-height:75px;border-radius: 5px;text-align: center;font-size:14px;}
	.father_zzc{width: 420px;height:80%;max-height:600px;position:fixed;top:45px;left:50%;margin-left:-200px;background:#fff;z-index: 5;border-radius: 10px;display:none;overflow: auto;}
	#yzq_content{width: 400px;height:600px;background:#fff;z-index: 6;border-radius: 10px;}
	#yzq_content>i{position:absolute;right:10px;top:5px;font-size:25px;}
	.contain_tr{padding-left:30px;padding-top:28px;}
	.contain_tr h2{padding:0;font-size:22px;}
	.contain_tr h3{padding:10px 0;font-size:16px;color:#666;}
	.contain_tr>.xz_list a{display:inline-block;width:80px;height:28px;margin-left:10px;color:#666;text-align: center;line-height:28px;border-radius: 30px;border:1px solid #ccc;position:relative;}
</style>
<style type="text/css">
	.bg-1 {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}
.radius:hover{
 	color: #fff;
	border-color: #66b1ff;
	background-color: #66b1ff;
 }
 span:hover{
 	color: #333;
 }
 .btn-primary {
    color: #fff;
    background-color: #409eff;
    border-color: #409eff;
    height: 31px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 24px !important;
}
</style>
    <link rel="stylesheet" type="text/css" href="__SYSMET__/h-ui.admin/css/kaiguans.css" />
    
    
    <div id="zzc"></div>
    <div id="tsk"></div>
    <div class="father_zzc">
    	   <div id="yzq_content">
    	        <i class="Hui-iconfont" id="close_yzq">&#xe6a6;</i>
		    	<div class="contain_tr">
		    		<h2 id="yanzhengtitle">两步验证</h2>
		    		<h3>1.在手机上下载并安装Google身份验证器</h3>
		    		<div class="xz_list" style="padding:10px 0;">
		    			<a style="margin-right:50px;" class="down_code" id="Android" href="javascript:;">Android</a>
		    			<a class="down_code" href="javascript:;" id="IOS">IOS</a>
		    		</div>
		    		<div id="hide_code" style="">
		    			<div style="display:block;position:relative;border:1px solid #f00;width:280px;border-radius: 10px;" id="Android_show">
		    				<i style="position:absolute;width:0;height:0;border:10px solid transparent;top:-23px;left:44px;border-bottom:13px solid #f00;"></i>
		    			    <i style="position:absolute;width:0;height:0;border:10px solid transparent;top:-22px;left:44px;border-bottom:15px solid #fff;"></i>
		    				<p style="text-align: center;color:#f00;margin-top:8px;">请使用安卓手机浏览器扫描并下载</p>
		    				<img style="width:140px;display:block;margin:0 auto 10px;" src="__TEMPLATE__/mobile/index/img/Android_code.png" />
		    			</div>
		    			<div style="display:none;position:relative;border:1px solid #f00;width:280px;border-radius: 10px;" id="IOS_show">
		    				<i style="position:absolute;width:0;height:0;border:10px solid transparent;top:-23px;right:76px;border-bottom:13px solid #f00;"></i>
		    			    <i style="position:absolute;width:0;height:0;border:10px solid transparent;top:-22px;right:76px;border-bottom:15px solid #fff;"></i>
		    				<p style="text-align: center;color:#f00;margin-top:8px;">请使用苹果手机扫描并下载</p>
		    				<img style="display:block;width:140px;margin:0 auto 10px;" src="__TEMPLATE__/mobile/index/img/ios_code.png" />
		    			</div>
		    		</div>
		    		<!--<p style="color: #444;">安卓用户也可在各大应用市场搜索[谷歌身份验证器]下载</p>-->
		    		<h3>2.打开Google身份验证器，扫描下方二维码</h3>
		    		<div style="width:280px;"><img style="display:block;width:140px;margin:10px auto;" src="__TEMPLATE__/mobile/index/img/anzhuang_code.png" id="yanzhengimg"/></div>
		    		<div style="margin-top:30px;">
		    			<input style="width:200px;text-indent:10px;height:26px;display:block;float:left;border:1px solid #ccc;border-radius:4px;" type="text" value="" id="gg_yzq"/>
		    			<span class="fuzhibtn_copy" style="display:block;width:70px;margin-left:5px;height:28px;float:left;background:#ff6cb5;line-height:28px;border-radius: 4px;color:#fff;text-align: center;">复制</span>
		    		</div>
		    	</div>
		    </div>
    </div>
    
 <nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    系统管理
    <span class="c-gray en">&gt;</span>
   
    后台权限
    <span class="c-gray en">&gt;</span>
   
    管理员管理
    <a class="btn btn-success radius r"
      style="line-height: 1.6em; margin-top: 3px"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="Hui-iconfont">&#xe68f;</i>
    </a>
  </nav>
  
  <div style="padding:20px;height:30px;">
  	
  	<div class="new_box">
  <div>
    <h1  style="line-height:50px;float:left;font-size:18px;margin:0 10px;padding:0;padding-left:20px;">管理员列表</h1>
    <a style="float:right;margin-right:20px;margin-top:10px;" class="btn btn-primary radius" href="{:url('Rbac/am_new')}">增加管理员</a>
</div>

  <div class="page-container" style="padding-top:0;">
      <div id="tab-system" class="HuiTab">
          <div class="mt-20">
            <table
              class="table table-border table-bordered table-bgt able-hover table-sort table-responsive">
              <thead>
                <tr class="text-c">
                  <th>ID</th>
                  <th>账号</th>
                  <th>姓名</th>
                  <th>生成谷歌验证码</th>
                  <th>是否开启谷歌验证</th>
                  <th>最后一次登录时间</th>
                  <th>登录IP</th>
                  <th>操作</th>
                 
                </tr>
                 {volist name="list" id="v"}
              </thead>
              <tbody>
              
                <tr class="text-c">
                  <td>{$v.uid}</td>
                  <td>{$v.nickname}</td>
                  <td>{$v.name}</td>
                  <td style="width: 120px;">
        {if condition="$v.secretKey"}
                    <a href="javascript:;" onclick="gg_yzq(this,{$v.id})">显示</a>
                    
         {else/}
                    <a href="{:url('rbac/google')}?uid={$v.uid}" >生成</a>
         {/if}
                  </td>
                  <td style="width: 120px;">
                    <div class="toggle toggle--knob">
                        {if condition="$v.googleauth eq 1"}
                        <input type="checkbox" id="toggle--knob-{$v.uid}" class="toggle--checkbox" >
                        {else/}
                        <input type="checkbox" id="toggle--knob-{$v.uid}" class="toggle--checkbox" checked>
                        {/if}
                        <label class="toggle--btn" for="toggle--knob-{$v.uid}" onclick="func(this,{$v.uid})">
                            <span class="toggle--feature" data-label-on="on"  data-label-off="off"></span>
                        </label>
                    </div>
                    
                  </td>
                  <td>{$v.time|date="Y-m-d H:i:s",###}</td>
                  <td>{$v.ip}</td>
                  <td>
                      <?php if($v['uid']==1){ ?>
                        <font color="#cccccc">权限设置</font> |
                        <font color="#cccccc">编辑</font> |
                        <font color="#cccccc">删除</font>
                    <?php }else{ ?>
                       
                            <a href="/admin/Rbac/am_qxgl?uid={$v.uid}">角色设置</a> |
                      
                        
                            <a href="/admin/Rbac/am_edit?uid={$v.uid}">编辑</a> |
                        
                            <a href="javascript:;"onclick="if(confirm('是否确认操作？')) {window.location.href='/admin/Rbac/am_delete?uid={$v.uid}'}">删除</a>
                       
                    <?php } ?>

                  </td>
                 
                    
                </tr>
               {/volist}
              </tbody>
            </table>
          </div>
      </div>
    </div>
   </div>
    </div>
{/block}
{block name="js"}
 <script type="text/javascript" src="__SYSMET__/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript">
    $(function() {
        $('.skin-minimal input').iCheck({
            checkboxClass : 'icheckbox-blue',
            radioClass : 'iradio-blue',
            increaseArea : '20%'
        });
        $("#tab-system").Huitab({
            index : 0
        });
    });
</script>
<script type="text/javascript">
   function gg_yzq(obj,id){
        var id=id;
        $.ajax({
            type : 'post',
            url : "{:url('rbac/am_select')}",
            data:{'id':id},
            dataType : 'json',
            success : function(data) {
            	console.log(data);
                document.getElementById("gg_yzq").value = data.secretKey;
                document.getElementById("yanzhengtitle").innerHTML = "(用户名："+data.username+")&nbsp;&nbsp;两步验证";
                $("#yanzhengimg").attr('src','../../'+data.pic);
            }
    });

        $('#zzc').show()
        $('.father_zzc').show()
   }
   $('#close_yzq').click(function(){
   	  $('#zzc').hide()
	  $('.father_zzc').hide()
   })
   $('.down_code').click(function(){
   	$('#hide_code').children('div').hide()
   	  var this_id=$(this).attr('id')
   	  if($('#'+this_id+'_show').css('display')=='block'){
   	  	$('#'+this_id+'_show').hide()
   	  }else{
   	  	$('#'+this_id+'_show').show()
   	  }
   })
  
   $('.fuzhibtn_copy').click(function(){
		var Url2=document.getElementById("gg_yzq");
		Url2.select(); 
		document.execCommand("Copy"); 
		$('#tsk').css('display','block').html('已复制好，可贴粘。')
        setTimeout(function(){$('#tsk').css('display','none')},1000)
   })
    function func(obj, id) {
        if ($("#toggle--knob-"+id).is(':checked')) {
            var shijian='开启';
        }else{
            var shijian='关闭';
        }
        
        $.ajax({
            type : 'post',
            url : "{:url('rbac/change')}",
            data:{'id':id},
            dataType : 'html',
            success : function(data) {
                
                if(data == 'true'){
                    layer.msg('已'+shijian+'!', {
                        icon : 1,
                        time : 1000
                    });
                    //setTimeout('window.location.reload()',1000);
                }

            },
             error : function(data) {
                 console.log(data.msg);
             },
        });

    }


</script>
<!-- <script type="text/javascript">
    function makegoole(uid){
      var uid=uid;
      
     alert(uid);
     $.ajax({
      type:'post',
      url:'admin/Rbac/goole',
      date:{'uid':uid},
      dataType:'json',
      success:function(data){
        alert("000");
      },
     });
    }

</script> -->
{/block}


